<!--
/**
* Author: txj
* Date: 2023年8月15日10:12:20 
* Desc:  卖品item
*/
-->
<template>
  <view class="nav-right-item">
    <image class="image" :src="item.imageUrl" />
    <view class="flex-1">
      <view class="fs28 fc3 b">{{ item.name }}</view>
      <view v-if="item.goodsDesc" class="fs24 fc6 mt20">{{ item.goodsDesc }}</view>
    </view>
    <view class="item-money">
      <price :price="item.salePrice" unit-size="24" price-size="38" color="#333"></price>

      <yy-stepper v-model="num" :min="0" :max="item.stockType === '1' ? 9999 : item.stock" @change="changeNum(item)" />
    </view>
  </view>
</template>

<script>
  import Price from '@/components/Price'
  export default {
    // 挂载组件
    components: { Price },
    // 数据
    data() {
      return {
        chooseNum: 0
      }
    },
    props: {
      itemData: {
        type: Object
      },
      value: {
        type: [Number, String]
      }
    },

    // 挂载方法
    methods: {
      changeNum(item) {
        console.log(item)
      }
    },
    computed: {
      num: {
        set(v) {
          this.$emit('input', v)
        },
        get() {
          return this.value
        }
      },
      item() {
        return this.itemData
      }
    }
  }
</script>
<style lang="scss" scoped>
  .nav-right-item {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    padding: 20rpx;
    background: #fff;
    .image {
      margin-right: 10rpx;
      width: 160rpx;
      height: 160rpx;
    }
    .item-money {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      flex-direction: column;
      padding-bottom: 10rpx;
    }
  }
</style>
